package com.itheima.dao.system;

import com.itheima.domain.system.Dept;
import com.itheima.domain.system.SysLog;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

/**
 * 日志
 */
public interface SysLogDao {
    /**
     * 添加日志
     */
    @Insert("INSERT INTO ss_sys_log(id,user_name,ip,TIME,method,ACTION) VALUES(#{id},#{username},#{ip},#{time},#{method},#{action})")
    int insert(SysLog sysLog);

    @Results(id="systemLogMap",value = {
            @Result(column = "id",property = "id",jdbcType = JdbcType.VARCHAR),
            @Result(column = "user_name",property = "username",jdbcType = JdbcType.VARCHAR),
            @Result(column = "ip",property = "ip",jdbcType = JdbcType.VARCHAR),
            @Result(column = "time",property = "time",jdbcType = JdbcType.DATETIMEOFFSET),
            @Result(column = "method",property = "method",jdbcType = JdbcType.VARCHAR),
            @Result(column = "action",property = "action",jdbcType = JdbcType.VARCHAR)
    })
    @Select("SELECT * FROM ss_sys_log")
    List<SysLog> findAll();
}
